<template>
  <div class="register-main base-main">
    <p class="color333 title">设置新密码</p>
    <div class="centent">
      <p class="color333 fs12 sub-title">新密码</p>
      <p class="line-bottom input-p fs15 w100">
        <input v-model="pwd" class="w100" type="password" placeholder="请输入您的新密码"/>
      </p>
      <p class="color333 fs12 sub-title">确认密码</p>
      <p class="line-bottom input-p fs15 w100">
        <input v-model="confirmPwd" class="w100" type="password" placeholder="请再次输入您的新密码"/>
      </p>
    </div>

    <p class="btn-register">
      <span class="base-btn fs15" @click="haneldRestPwd">确认修改并登录</span>
    </p>

    <p class="text-c btn-to-login">
      <span class="color333 fs14" @click="toLogin">返回登录</span>
    </p>
  </div>
</template>

<script type="text/ecmascript-6">
  export default {
    data() {
      return {
        pwd: '', // 密码
        confirmPwd: '', // 确认密码
      }
    },
    methods: {
      // 确认修改并登录
      haneldRestPwd() {
        const _this = this
        if(!_this.pwd) {
          _this.$toast("请填写新密码")
          return false
        } else if (!_this.confirmPwd) {
          _this.$toast("请填写确认密码")
          return false
        } else if (_this.pwd != _this.confirmPwd) {
          _this.$toast("两次输入的密码不一致")
          return false
        } else {
          console.log(this.pwd);
          console.log(this.confirmPwd);
        }
      },
      // 返回登录
      toLogin() {
        this.$router.push({
          name: 'login'
        })
      },
    },
  }
</script>

<style scoped lang="scss">
  @import '../../assets/css/register.scss';
</style>
